#!/bin/bash

#拉代码
git pull origin 2019-11-06-saas-dev2
#发布的APP
APPS=("oms-provider" "oms-worker")
#版本号
VERSION="1.0-SNAPSHOT"
#本地路径
ROOT=$(cd `dirname $0`; pwd)
echo "请选择发布环境 dev test ?"
read env
cd $ROOT
mvn clean install -Dmaven.test.skip=true -P $env
#循环部署代码
for APP in ${APPS[@]}
do
    echo "是否部署 ${REMOTE} ${APP} 模块代码[y/n]: ?"
    read deploy
    if [ "$deploy" = "y" -o  "$deploy" = "Y" ]
    then
        APPROOT="${ROOT}/${APP}/target"
        sh ../../lsh-oms/${APP}/bin/deploy.sh $APPROOT/$APP-$VERSION-$env.tar.gz
    fi
done